********************************************************************************
* Replication data for "Do Voters Care about the Age of their Elected Representatives?"
*
* Experimental study: Candidate age and support for state legislative candidate
* 2020 Cooperative Election Study module
********************************************************************************

* Figure 1
* Likelihood of voting for the state legislator
********************************************************************************
table agetreat, c(mean aelvote)

regress aelvote youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aelvote if oldsl~=1, by(youngsl)
ttest aelvote if youngsl~=1, by(oldsl)

* Figure 1
* Perception of how well the candidate would represent the district 
********************************************************************************
table agetreat, c(mean aeqrep)

regress aeqrep youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aeqrep if oldsl~=1, by(youngsl)
ttest aeqrep if youngsl~=1, by(oldsl)

* Figure 2
* Perceptions of candidate traits
********************************************************************************

* Well-qualified to serve in the state legislature
logit aequal youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aequal if oldsl~=1, by(youngsl)
ttest aequal if youngsl~=1, by(oldsl)

* Knowledgeable about the issues
logit aeknow youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aeknow if oldsl~=1, by(youngsl)
ttest aeknow if youngsl~=1, by(oldsl)

* Inexperienced
logit aeinex youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aeinex if oldsl~=1, by(youngsl)
ttest aeinex if youngsl~=1, by(oldsl)

* Cares about people like you 
logit aecare youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aecare if oldsl~=1, by(youngsl)
ttest aecare if youngsl~=1, by(oldsl)

* Out of touch with ordinary people
logit aeoot youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aeoot if oldsl~=1, by(youngsl)
ttest aeoot if youngsl~=1, by(oldsl)

* Trustworthy 
logit aetrust youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aetrust if oldsl~=1, by(youngsl)
ttest aetrust if youngsl~=1, by(oldsl)

* Stands up for what he believes in
logit aestand youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aestand if oldsl~=1, by(youngsl)
ttest aestand if youngsl~=1, by(oldsl)

* Conservative
logit aecon youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aecon if oldsl~=1, by(youngsl)
ttest aecon if youngsl~=1, by(oldsl)

* Liberal
logit aelib youngsl oldsl
margins, at(youngsl=(0(1)1) oldsl=(0(1)1))

ttest aelib if oldsl~=1, by(youngsl)
ttest aelib if youngsl~=1, by(oldsl)

* Table A1
* Heterogeneous treatment effects by respondent age
********************************************************************************

regress aelvote youngsl##c.age oldsl##c.age

regress aeqrep youngsl##c.age oldsl##c.age

* Figure A1 and Figure A2
* Heterogeneous treatment effects by respondent generation
********************************************************************************

regress aelvote agetreat##generat
margins, at(agetreat=(1(1)3) generat=(1(1)5))

regress aeqrep agetreat##generat
margins, at(agetreat=(1(1)3) generat=(1(1)5))


* Table A2 and Figure A3
* Heterogeneous treatment effects by respondent ideology
********************************************************************************

regress aelvote youngsl##c.ideo7 oldsl##c.ideo7
regress aeqrep youngsl##c.ideo7 oldsl##c.ideo7

regress aelvote agetreat##c.ideo7
margins, dydx(agetreat) at(ideo7=(0(1)6))
margins, at(agetreat=(1(1)3) ideo7=(0(1)6))

regress aeqrep agetreat##c.ideo7
margins, dydx(agetreat) at(ideo7=(0(1)6))
margins, at(agetreat=(1(1)3) ideo7=(0(1)6))


* Perceived traits as mediators of candidate age treatment on candidate evaluations
********************************************************************************

* Figure A4, Table A3, Table A5: Likelihood of supporting candidate mediation models
medeff (probit aequal youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aequal)
medeff (probit aeknow youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeknow)
medeff (probit aeinex youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeinex)
medeff (probit aecare youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aecare)
medeff (probit aeoot youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeoot)
medeff (probit aetrust youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aetrust)
medeff (probit aestand youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aestand)
medeff (probit aecon youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aecon)
medeff (probit aelib youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aelib)

medeff (probit aequal youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aequal)
medeff (probit aeknow youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeknow)
medeff (probit aeinex youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeinex)
medeff (probit aecare youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aecare)
medeff (probit aeoot youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeoot)
medeff (probit aetrust youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aetrust)
medeff (probit aestand youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aestand)
medeff (probit aecon youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aecon)
medeff (probit aelib youngsl oldsl) (regress aelvote aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aelib)

* Figure A5, Table A4, Table A5: Perceptions of candidate's ability to represent district
medeff (probit aequal youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aequal)
medeff (probit aeknow youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeknow)
medeff (probit aeinex youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeinex)
medeff (probit aecare youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aecare)
medeff (probit aeoot youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aeoot)
medeff (probit aetrust youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aetrust)
medeff (probit aestand youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aestand)
medeff (probit aecon youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aecon)
medeff (probit aelib youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(youngsl) mediate(aelib)

medeff (probit aequal youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aequal)
medeff (probit aeknow youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeknow)
medeff (probit aeinex youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeinex)
medeff (probit aecare youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aecare)
medeff (probit aeoot youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aeoot)
medeff (probit aetrust youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aetrust)
medeff (probit aestand youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aestand)
medeff (probit aecon youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aecon)
medeff (probit aelib youngsl oldsl) (regress aeqrep aequal aeknow aeinex aecare aeoot aetrust aestand aecon aelib youngsl oldsl) , treat(oldsl) mediate(aelib)

